#-- coding:UTF-8 --

import os
import sys
import time
import datetime

# 项目地址
resourcePath = os.path.realpath("../build/res/")
targetCdnUri = "qjwx_test/mini_0.0.128/"


# 获得当前时间
def getNowTime():
    now = datetime.datetime.now()
    # 转换为指定的格式:
    nowTime = now.strftime("%Y-%m-%d %H:%M:%S")
    return nowTime

def printNow(str):
    print(getNowTime() + " " + str)
    sys.stdout.flush()

# 上传cdn
def uploadCDN():
    printNow("Start uploadCDN")
    os.system("coscmd config -a AKIDLafy4v97WkjaM4t4PXklYEl9SiljE9cr -s GaHn3RPZXM5ZwX5sTtRnyyjJjNAnBSUG -b game-zj-cdn-1251697691 -r ap-shanghai -m 30 --do-not-use-ssl")
    cmd = f"coscmd upload -r {resourcePath}"
    os.system(f"{cmd} {targetCdnUri}")
    printNow("End uploadCDN")

# main
uploadCDN()
